package com.acwing.partition35;

import java.io.*;
import java.math.BigInteger;

/**
 * @author `RKC`
 * @date 2022/3/13 9:18
 */
public class AC3418杨辉三角形_暴力 {

    private static final int N = 1000;
    private static BigInteger[][] f = new BigInteger[N][N];

    private static final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    private static final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        for (int i = 1; i < N; i++) {
            f[i][0] = new BigInteger("1");
            for (int j = 1; j <= i; j++) {
                if (f[i - 1][j] == null) f[i - 1][j] = new BigInteger("0");
                if (f[i - 1][j - 1] == null) f[i - 1][j - 1] = new BigInteger("0");
                f[i][j] = f[i - 1][j].add(f[i - 1][j - 1]);
            }
        }
        int n = Integer.parseInt(reader.readLine()), ans = 1;
        boolean flag = false;
        for (int i = 1; i < N; i++) {
            for (int j = 0; j < i; j++, ans++) {
                if (n == f[i][j].longValue()) {
                    flag = true;
                    break;
                }
            }
            if (flag) break;
        }
        writer.write(ans + "\n");
        writer.flush();
    }
}
